Release 10.1A: OpenEdge Development:
Web Services
Example 4GL accessing a SOAP fault
The following procedure fragment runs an operation on a fictitious Web service that returns a SOAP fault identical to the one described in the beginning of this section (see the "Handling SOAP faults" section). It accesses and begins to examine the SOAP fault message as described in the following steps that match the numbered comments (
/*1*/to/*7*/) in the code.This code:
- Uses the 4GL
VALID-HANDLEfunction to determine if a givenERRORcondition (ERROR-STATUS:ERROR=TRUE) is caused by a SOAP fault by testing the validity of the handle returned by theERROR-STATUS:ERROR-OBJECT-DETAILattribute.Note: You can also use the- Assigns a handle variable (
hSoapFault) to any valid SOAP fault object returned by theERROR-STATUS:ERROR-OBJECT-DETAILattribute for code readability.ERROR-STATUS:ERROR-OBJECT-DETAILhandle attribute directly to work with the SOAP fault object.- Examines the values of SOAP fault elements, as required, using appropriate attributes (
SOAP-FAULT-CODE) on the SOAP fault object handle.- Uses the 4GL
VALID-HANDLEfunction to determine if this SOAP fault has SOAP fault detail by testing the validity of the handle returned byhSoapFault:SOAP-FAULT-DETAIL.Note: You can also use the- Assigns a handle variable (
hSoapFaultDetail) to the SOAP fault-detail object returned by thehSoapFault:SOAP-FAULT-DETAILattribute for code readability.ERROR-STATUS:ERROR-OBJECT-DETAIL:SOAP-FAULT-DETAILhandle attribute directly to work with the SOAP fault-detail object.- Returns the root node of the underlying SOAP fault
<detail>element by using thehSoapFaultDetail:GET-NODE()method to assign the root node to the x-noderef object referenced by the handle variablehxnoderef.- Can now use the methods and attributes of the x-noderef object handle (
hxnoderef) and additional handle variables to walk the XML DOM subtree referenced byhxnoderefto examine the content of the SOAP fault<detail>element as specified by the WSDL for the Web service.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |